var app = getApp()
Page({

  /**
   * 页面的初始数据
   */

  data: {
    // 自定义底部导航
    isLoading: !0,
    footer: {
      footerTab: 4,
      footerlist: [{
        text: "首页",
        img: "/hyb_yl/images/tab01.png",
        selimg: "/hyb_yl/images/tab1.png",
        url: "/hyb_yl/tabBar/index/index"
      }, {
        text: "资讯",
        img: "/hyb_yl/images/tab02.png",
        selimg: "/hyb_yl/images/tab2.png",
        url: "/hyb_yl/tabBar/jibingyufang/jibingyufang"
      }, {
        text: "分享",
        img: "/hyb_yl/images/tab03.png",
        selimg: "/hyb_yl/images/tab3.png",
        url: "/hyb_yl/tabBar/community/community"
      }, {
        text: "药房",
        img: "/hyb_yl/images/tab04.png",
        selimg: "/hyb_yl/images/tab4.png",
        url: "/hyb_yl/tabBar/shop/shop"
      }, {
        text: "问诊",
        img: "/hyb_yl/images/tab04.png",
        selimg: "/hyb_yl/images/tab4.png",
        url: "/hyb_yl/tabBar/fastnavigate/fastnavigate"
      }, {
        text: "我的",
        img: "/hyb_yl/images/tab05.png",
        selimg: "/hyb_yl/images/tab5.png",
        url: "/hyb_yl/tabBar/my/my"
      }]
    },
  },
  fastnavigate(e) {
    let tit = e.currentTarget.dataset.tit
    let url = e.currentTarget.dataset.url
    var ser_key = e.currentTarget.dataset.ser_key
    var id = e.currentTarget.dataset.id
    // wx.navigateTo({
    //   url: url + '?tit=' + tit + '&ser_key=' + ser_key+'&id='+id,
    // })
    if (ser_key == 'shoushukuaiyue') {
      wx.navigateTo({
        url: url + '?tit=' + tit + '&ser_key=' + ser_key + '&pinyin=' + ser_key + '&typs=query' + '&id=' + id + '&key_words=' + ser_key + '&ifzy=0',
      })
    } else if (ser_key == 'tijianjiedu') {
      wx.navigateTo({
        url: '/hyb_yl/backstageServices/pages/baogaojiedu/baogaojiedu?key_words=tijianjiedu' + '&id=' + id + '&key_words=' + ser_key + '&ifzy=0',
      })
    } else {
      wx.navigateTo({
        url: url + '?tit=' + tit + '&ser_key=' + ser_key + '&id=' + id + '&key_words=' + ser_key + '&ifzy=0'+'&name='+tit,
      })
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    this.getfooter()
    this.getServer()
    var index = options.index
    that.setData({
      index: index
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  getfooter() {
    var that = this
    app.util.request({
      url: "entry/wxapp/index.footerlist",
      data: {
        openid: wx.getStorageSync('openid')
      },
      success: function (resing) {
        let footers = {
          footerTab: that.data.index,
          footerlist: resing.data
        };
        that.setData({
          footer: footers
        })
      }
    })
  },
  //查询所有服务
  getServer() {
    var that = this
    app.util.request({
      url: "entry/wxapp/index.kjserverlist",
      success: function (resing) {
        console.log(resing)
        that.setData({
          types: resing.data,
          isLoading: !1
        })
      }
    })
  },
})